<template>
	<view style="padding: 20px;">
		<view style="display: flex; flex-wrap: wrap;">
			<view style="width: 50%; padding: 10px;margin-top: 0rpx;" v-for="(item, index) in devicetData" :key="index">
				<view style="width: 100%; border-radius: 5rpx; height: 190rpx; margin-bottom: 10rpx;text-align: center;
					" @click="gotoPage('/pages/index/monitorInfo', item)">
					<view style="width: 100%;display: flex;justify-content: center;">
						<image src="../../static/images/1.png"
							style="width: 250rpx; height: 160rpx;"></image>
							<!-- <image :src="item.picUrl"
								style="width: 220rpx;height: 220rpx;margin-top: 15rpx;"></image> -->
					</view>
					<view style="width: 100%; display: flex;justify-content: center;margin: 10rpx 0rpx;">
						<view
							style="font-weight: 700; font-size: 20rpx;width: 250rpx;background-color: #fff;margin-top: 10rpx;border-radius: 5rpx;padding: 10rpx 0rpx;">
							{{item.name}}
						</view>

					</view>

				</view>
			</view>
		</view>
	</view>
</template>
<!-- craftName	String	工艺段名称
equipmentName	String	设备名称
productName	String	产品名称-购买名称
equipmentNum	String	设备编号
deviceType	String	设备大类
equipmentLevel	String	设备等级
madeIn	String	产地
produceDate	Date	出场日期
brand	String	品牌
supplier	String	供应商
flag	int	0:正常使用 1:备用 2:报废 3:库存
craftPic	String	设备对应二维码图片
picUrl	String	设备图片地址 -->
<script>
	import {
		queryCameraLists
	} from "@/api/index"
	import {
		getToken,
		setToken,
		removeToken
	} from '@/utils/auth'
	export default {
		data() {
			return {
				form:{},
				devicetData:[],
				pageSize: 10,
				pageNum: 0,
				pageTotal: 0,
				isFinish: false,
				isNoMore: false,
			}
		},
		onLoad: function (option) {
			this.form.craftName = JSON.parse(option.item).craftName;
					},
		onReady() {
			this.getServerData1();
		},
		methods: {
			getServerData1() {
				
				console.info('----', this.pageNum)
				this.form.pageNum = this.pageNum
				this.form.pageSize = this.pageSize
				uni.showLoading({
					title: '加载中'
				});
				queryCameraLists(this.form).then(response => {
					// 使用示例
					this.devicetData = response["2aa1872ed124495381992f09a50c6074"];
					console.info('aaaaaaa',response["2aa1872ed124495381992f09a50c6074"])
					
				})
				setTimeout(function() {
					uni.hideLoading();
				}, 500);

			},
			gotoPage(url, item) {
				console.log("--------", JSON.stringify(item))
			
				console.log("--------", url)
				uni.navigateTo({
					url: url + '?item=' + JSON.stringify(item)
				})
			},
			
			onPullDownRefresh() {
				console.log('下拉刷新')
				this.getServerData1();
				setTimeout(() => {
					console.log('下拉刷新停止')
					uni.stopPullDownRefresh()
				}, 2000)
			},
			// 上拉加载
			onReachBottom() {
				console.log('上拉加载')
				this.isFinish = true
				this.pageNum++;
				this.getServerData1();
				
			},
		}
	}
</script>

<style>

</style>